<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>WorkPort</title>
    <link rel="stylesheet" type="text/css" href="../lib/kendo/styles/kendo.common-bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="../lib/kendo/styles/kendo.bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="../css/style.css">
    <link rel="stylesheet" type="text/css" href="../css/layout.css">
    <script src="../lib/kendo/js/jquery.min.js"></script>
    <script src="../lib/kendo/js/kendo.all.min.js"></script>
    <script src="../lib/kendo/js/jquery.transit.min.js"></script>
    <script src="../lib/jquery.slimscroll.min.js"></script>
    <script src="../js/svs.framework.js"></script>
    <script src="../js/wp.js"></script>
    <script src="../js/community.api.js"></script>
    <script src="../js/stream.api.js"></script>
</head>

<body>
    <script type="text/javascript">
    function getHome(){
    	Workport.CommunityAPI.getCommunityHome(function(data){    
    		$('#result').get(0).innerText += (new Date() + ":" + JSON.stringify(data) + "\n");
    		console.log(data);
    	},{	pageSize : 10, 
			pageNumber : '',
			key : '',
			type : 0 }
    	);
    }
    function getPreview(){
    	Workport.StreamAPI.getCommunityPreview(function(data){    
    		$('#result').get(0).innerText += (new Date() + ":" + JSON.stringify(data) + "\n");
    		console.log(data);
    	},{	pageSize : 10, 
			pagePosition : '',
			order : 'A',
			type : 0}
    	);
    }
    function getMember(){
    	Workport.CommunityAPI.getCommunityMemberShip(function(data){    
    		$('#result').get(0).innerText += (new Date() + ":" + JSON.stringify(data) + "\n");
    		console.log(data);
    	},{	
    		communityId : "2014421175126235",
    		pageSize : "10",
    		pagePosition : "0", 
    		type : "0"  }
    	);
    }
    function postMember(){
    	Workport.CommunityAPI.postMemberShip(function(data){    
    		$('#result').get(0).innerText += (new Date() + ":" + JSON.stringify(data) + "\n");
    		console.log(data);
    	},{	
    		communityId : "2014421175126235",
    		action : "0"  }
    	);
    }
    function putMember(){
    	Workport.CommunityAPI.putMemberShip(function(data){    
    		$('#result').get(0).innerText += (new Date() + ":" + JSON.stringify(data) + "\n");
    		console.log(data);
    	},{	
    		communityId : "2014421175126235",
    		user : "CA354180",
    		action: "0",
    		notificationId : "VulnerabilityT51" }
    	);
    }
    function subscribe(){
    	Workport.CommunityAPI.postSubscribe(function(data){    
    		$('#result').get(0).innerText += (new Date() + ":" + JSON.stringify(data) + "\n");
    		console.log(data);
    	},{	
    		communityId : "2014421175126235",
    		action : "0"  }
    	);
    }
    function search(){
    	Workport.CommunityAPI.search(function(data){    
    		$('#result').get(0).innerText += (new Date() + ":" + JSON.stringify(data) + "\n");
    		console.log(data);
    	},{	
    		pageSize : "10",
    		pagePosition : "1",
    		key : "A",
    		type : "1"  }
    	);
    }
    function getExport(){
    	Workport.CommunityAPI.getExport(function(data){    
    		$('#result').get(0).innerText += (new Date() + ":" + JSON.stringify(data) + "\n");
    		console.log(data);
    	},{	
    		notificationId : "VulnerabilityT51",
    		pageSize : "10",
    		pagePosition : "1",
    		targetId : "2014421175126235",
    		notificationType : "C"  }
    	);
    }
    function nominate(){
    	Workport.CommunityAPI.nominate(function(data){    
    		$('#result').get(0).innerText += (new Date() + ":" + JSON.stringify(data) + "\n");
    		console.log(data);
    	},{	
    		notificationId : "2014052710002",
    		targetId 	: "2014421175126235",
    		exports : "CA354180",
    		tags  : "ABC"  }
    	);
    }
    function getStats(){
    	Workport.CommunityAPI.getStat(function(data){    
    		$('#result').get(0).innerText += (new Date() + ":" + JSON.stringify(data) + "\n");
    		console.log(data);
    	},{	communityId : "2014421175126235"  }
    	);
    }
    function create(){
    	Workport.CommunityAPI.create(function(data){    
    		$('#result').get(0).innerText += (new Date() + ":" + JSON.stringify(data) + "\n");
    		console.log(data);
    	},{	
    		name : "cmd create",
    		description : "create by test page",
    		start : "7/14/2014 12:32:35 PM",
    		end : "7/14/2015 12:32:35 PM",
    		nickname : "test",
    		type : "Open",
    		logo : "QEBA",
    		tags : "test",
    		apps : "outlook,skype",
    		memebers : "239034",
    		managers : "309603"   	}
    	);
    }
    function exist(){
    	Workport.CommunityAPI.exist(function(data){    
    		$('#result').get(0).innerText += (new Date() + ":" + JSON.stringify(data) + "\n");
    		console.log(data);
    	},{	
    		name : "Atmention test community",
    		type : "1"  }
    	);
    }
    function getTypes(){
    	Workport.CommunityAPI.getTypes(function(data){    
    		$('#result').get(0).innerText += (new Date() + ":" + JSON.stringify(data) + "\n");
    		console.log(data);
    	});
    }
    function updateMember(){
    	Workport.CommunityAPI.postCommunityMemberShip(function(data){    
    		$('#result').get(0).innerText += (new Date() + ":" + JSON.stringify(data) + "\n");
    		console.log(data);
    	},{
    		communityId : "2014421175126235",
    	    users : [
	    	    {user : "CA239034",action : "0", isManager : true},
	    	    {user : "CA150219",action : "0", isManager : true},
	    	    {user : "CA160590",action : "0", isManager : false}
    	    ]
    	} );
    }
    function edit(){
    	Workport.CommunityAPI.editCommunity(function(data){    
    		$('#result').get(0).innerText += (new Date() + ":" + JSON.stringify(data) + "\n");
    		console.log(data);
    	},{	
    		communityId : "2014421175126235",
    		status : "Active",
    		name : "Edit by cmd",
    		description : "edit description by test page",
    		startDate : "07/15/14",
    		endDate  : "07/15/15",
    		nickname : "test",
    		type : "Moderated",
    		logo : "QEBA",
    		tags : "tag1,tagb",
    		apps : "app1;app2",
    		members : [ {user : "CA160590",action : "0", isManager : false} ],
    		managers : [{user : "CA239034",action : "0", isManager : true},
    		    	    {user : "CA150219",action : "0", isManager : true} ]
    		}
    	);
    }
    function getDetail(){
    	Workport.CommunityAPI.getCommunityDetail(function(data){    
    		$('#result').get(0).innerText += (new Date() + ":" + JSON.stringify(data) + "\n");
    		console.log(data);
    	},{	communityId : "2014421175126235"  }
    	);
    }
    function clearLog(){
    	$('#result').get(0).innerText = "";
    }
    </script>
    
</body>
	<input type = "button" onclick = "clearLog()" value="Clear"></br>
	<input type = "button" onclick = "getHome()" value="Home">
	<input type = "button" onclick = "getPreview()" value="Preview">
	<input type = "button" onclick = "getMember()" value="Get Community Member">
	<input type = "button" onclick = "postMember()" value="Post Member">
	<input type = "button" onclick = "putMember()" value="Put Member">
	<input type = "button" onclick = "subscribe()" value="Subscribe">
	<input type = "button" onclick = "search()" value="Search">
	<input type = "button" onclick = "getExport()" value="Expert">
	<input type = "button" onclick = "nominate()" value="Nominate">
	<input type = "button" onclick = "getStats()" value="Stats">
	<input type = "button" onclick = "create()" value="New">
	<input type = "button" onclick = "exist()" value="Exist">
	<input type = "button" onclick = "getTypes()" value="Types">
	<input type = "button" onclick = "updateMember()" value="Put Community Member">
	<input type = "button" onclick = "edit()" value="Edit">
	<input type = "button" onclick = "getDetail()" value="Detail">
	</br>
	
	<div id="result" style="margin: 0px;"></div>
	
</html>